#ifndef MAP_H_
#define MAP_H_

#ifdef NDEBUG
#	include "map.inl"
#	define INLINE inline
#else
#	define INLINE
#endif

class Map
{
public:
	static short const MAX_NAME = 20;
	static short const BLANK_TRAP = 0;
	static short const BLANK_TILE = -1;
	static short const CX_TILE = 32;
	static short const CY_TILE = 32;

	struct Tile
	{
		short	iGroundId;
		short	iSkyId;
		unsigned char iTrapId;
		bool	bBlocked;
	};

public:
	Map();
	~Map();

	void Free();

	void New(short width, short height);
	bool Load(char const *filename);
	bool Save(char const *filename) const;

	Tile& GetTile(int x, int y);
	Tile const& GetTile(int x, int y) const;

	int GetWidth()  const;
	int GetHeight() const;
	int GetXCount() const;
	int GetYCount() const;

	char const *GetName() const;
	void SetName(char const *value);

	bool IsBlocked(int x, int y) const;

private:
	Tile	*m_pTiles;
	short	m_iWidth;
	short	m_iHeight;
	char	m_sName[MAX_NAME];
};

#endif